package view.user;

import java.awt.Dimension;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JToggleButton;

import controller.ActionEvents.ActionHandler;

import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.border.Border;

import view.MainFrame;

import java.awt.Color;

public class Menu extends JPanel {
	
	/** Declares the needed JButton as final variables*/
	private final JToggleButton btnBalance;
	private final JToggleButton btnDeposit;
	private final JToggleButton btnWithdrawal;
	private final JToggleButton btnLeaderboard;
	private final JToggleButton btnAbout;
	private final JToggleButton btnTransfer;
	private final JToggleButton btnLogOut;
	private final JToggleButton btnStatistics;
	private final JToggleButton btnCreateAccount;
	private final ButtonGroup buttonGroup = new ButtonGroup();
	
	/** Declares the classes as an object */
	private MainFrame frame;
	private ActionHandler actionHandler;
	
	/**
	 * Create the panel.
	 */
	public Menu(ActionHandler actionHandler) {
		this.frame = frame;
		this.actionHandler = actionHandler;
		setPreferredSize(new Dimension(750, 64));
		setLayout(null);
		setBackground(Color.WHITE);
				

		btnBalance = new JToggleButton("");
//		btnBalance.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/balanceClicked.png")));
//	btnBalance.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/balance.png")));
	//	btnBalance.setBounds(0, 0, 89, 63);
		btnBalance.setBorderPainted(false);
		btnBalance.setContentAreaFilled(false);
		add(btnBalance); // Ads JButton to CardLayout.
		btnBalance.addActionListener(actionHandler);
		btnBalance.setActionCommand("showBalance");
		
		buttonGroup.add(btnBalance);
		
		btnDeposit = new JToggleButton("");
//		btnDeposit.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/depositClicked.png")));
//		btnDeposit.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/deposit.png")));
		btnDeposit.setBounds(83, 0, 89, 63);
		btnDeposit.setBorderPainted(false);
		btnDeposit.setContentAreaFilled(false);
		add(btnDeposit); // Ads JButton to CardLayout.
		btnDeposit.addActionListener(actionHandler);
		btnDeposit.setActionCommand("showDeposit");
		buttonGroup.add(btnDeposit);
		
		btnWithdrawal = new JToggleButton("");
//		btnWithdrawal.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/withdrawalClicked.png")));
//		btnWithdrawal.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/withdrawal.png")));
		btnWithdrawal.setBounds(166, 0, 82, 63);
		btnWithdrawal.setBorderPainted(false);
		btnWithdrawal.setContentAreaFilled(false);
		add(btnWithdrawal); // Ads JButton to CardLayout.
		btnWithdrawal.addActionListener(actionHandler);
		btnWithdrawal.setActionCommand("showWithdrawal");
		buttonGroup.add(btnWithdrawal);

		
		btnLeaderboard = new JToggleButton("");
//		btnLeaderboard.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/leaderboardClicked.png")));
//		btnLeaderboard.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/leaderboard.png")));
		btnLeaderboard.setBorderPainted(false);
		btnLeaderboard.setContentAreaFilled(false);
		buttonGroup.add(btnLeaderboard);
		btnLeaderboard.setBounds(574, 0, 89, 63);
		add(btnLeaderboard); // Ads JButton to CardLayout.
		btnLeaderboard.addActionListener(actionHandler);
		btnLeaderboard.setActionCommand("showLeaderboard");
		
		btnCreateAccount = new JToggleButton("");
//		btnCreateAccount.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/createAccountClicked.png")));
//		btnCreateAccount.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/createAccount.png")));
		btnCreateAccount.setBorderPainted(false);
		btnCreateAccount.setContentAreaFilled(false);
		buttonGroup.add(btnCreateAccount);
		btnCreateAccount.setBounds(323, 0, 89, 63);
		add(btnCreateAccount); // Ads JButton to CardLayout.
		btnCreateAccount.addActionListener(actionHandler);
		btnCreateAccount.setActionCommand("showCreateAccount");
		
		btnAbout = new JToggleButton("");
//		btnAbout.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/settingsClicked.png")));
//		btnAbout.setBounds(488, 0, 89, 63);
//		btnAbout.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/settings.png")));
		btnAbout.setBorderPainted(false);
		btnAbout.setContentAreaFilled(false);
		add(btnAbout); // Ads JButton to CardLayout.
		btnAbout.setActionCommand("showSettings");
		btnAbout.addActionListener(actionHandler);
		buttonGroup.add(btnAbout);
		
		btnTransfer = new JToggleButton("");
		btnTransfer.setBounds(249, 0, 82, 63);
		
		btnTransfer.addActionListener(actionHandler);
//		btnTransfer.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/transferClicked.png")));
//		btnTransfer.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/transfer.png")));
		btnTransfer.setBorderPainted(false);
		btnTransfer.setContentAreaFilled(false);
		btnTransfer.setActionCommand("showTransfer");
		add(btnTransfer); // Ads JButton to CardLayout.
		buttonGroup.add(btnTransfer);
		
		btnLogOut = new JToggleButton("");
//		btnLogOut.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/logoutClicked.png")));
//		btnLogOut.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/logout.png")));
		btnLogOut.setBounds(661, 0, 83, 63);
		btnLogOut.setBorderPainted(false);
		btnLogOut.setContentAreaFilled(false);
		add(btnLogOut); // Ads JButton to CardLayout.
		btnLogOut.addActionListener(actionHandler);
		btnLogOut.setActionCommand("showLogOff");
		buttonGroup.add(btnLogOut);
		
		btnStatistics = new JToggleButton("");
//		btnStatistics.setSelectedIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/statisticsClicked.png")));
//		btnStatistics.setIcon(new ImageIcon(Menu.class.getResource("/Pictures/green/statistics.png")));
		btnStatistics.setBounds(406, 0, 89, 63);
		btnStatistics.setBorderPainted(false);
		btnStatistics.setContentAreaFilled(false);
		btnStatistics.addActionListener(actionHandler);
		btnStatistics.setActionCommand("showStatistics");
		add(btnStatistics); // Ads JButton to CardLayout.
		buttonGroup.add(btnStatistics);

	} // End constructor

	/**
	 * @return the btnBalance
	 */
	public JToggleButton getBtnBalance() {
		return btnBalance;
	}

	/**
	 * @return the btnDeposit
	 */
	public JToggleButton getBtnDeposit() {
		return btnDeposit;
	}

	/**
	 * @return the btnWithdrawal
	 */
	public JToggleButton getBtnWithdrawal() {
		return btnWithdrawal;
	}

	/**
	 * @return the btnLeaderboard
	 */
	public JToggleButton getBtnLeaderboard() {
		return btnLeaderboard;
	}

	/**
	 * @return the btnAbout
	 */
	public JToggleButton getBtnAbout() {
		return btnAbout;
	}

	/**
	 * @return the btnTransfer
	 */
	public JToggleButton getBtnTransfer() {
		return btnTransfer;
	}

	/**
	 * @return the btnLogOut
	 */
	public JToggleButton getBtnLogOut() {
		return btnLogOut;
	}

	/**
	 * @return the btnStatistics
	 */
	public JToggleButton getBtnStatistics() {
		return btnStatistics;
	}

	/**
	 * @return the btnCreateAccount
	 */
	public JToggleButton getBtnCreateAccount() {
		return btnCreateAccount;
	}
	
} // End class Menu.java
